const themesConfig=require("./theme.json")
module.exports = {
  data: {
      theme: '',
      themeConfig:{}
  },
  themeChanged(theme) {
      console.log('theme',theme)
      if (theme=='dark') {
        this.setData({
            theme:theme,
            themeConfig:themesConfig.dark
        });
      }else{
        this.setData({
            theme:theme,
            themeConfig:themesConfig.light
        });
      }
      
  },
  onShow() {
      const app = getApp();
      this.themeChanged(app.globalData.theme);
      app.watchThemeChange(this.themeChanged);
  },
  onUnload() {
      getApp().unWatchThemeChange(this.themeChanged);
  },
};